package com.echo.util;

import android.content.Context;
import android.widget.Toast;

import com.echo.http.HttpCallBack;
import com.echo.setting.Settings;


/**
 * Toast管理工具类
 * Created by EchoGe on 16/4/5.
 */
public class ToastUtils {
    private ToastUtils()
    {
        /* cannot be instantiated */
        throw new UnsupportedOperationException("cannot be instantiated");
    }

    /**
     * 短时间显示Toast
     */
    public static void showShort(Context context, CharSequence message)
    {
        if (Settings.isToastShow)
            Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
    }

    /**
     * 短时间显示Toast
     */
    public static void showShort(Context context, int message)
    {
        if (Settings.isToastShow)
            Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
    }

    /**
     * 长时间显示Toast
     */
    public static void showLong(Context context, CharSequence message)
    {
        if (Settings.isToastShow)
            Toast.makeText(context, message, Toast.LENGTH_LONG).show();
    }

    /**
     * 长时间显示Toast
     */
    public static void showLong(Context context, int message)
    {
        if (Settings.isToastShow)
            Toast.makeText(context, message, Toast.LENGTH_LONG).show();
    }

    /**
     * 自定义显示Toast时间
     */
    public static void show(Context context, CharSequence message, int duration)
    {
        if (Settings.isToastShow)
            Toast.makeText(context, message, duration).show();
    }

    /**
     * 自定义显示Toast时间
     */
    public static void show(Context context, String message, int duration)
    {
        if (Settings.isToastShow)
            Toast.makeText(context, message, duration).show();
    }
}
